﻿// JScript 文件
$(document).ready(function() {
	$(".messages_error").fadeIn("slow",function()
	    {
	        setTimeout(function(){$(".messages_error").fadeOut("slow")},3000);
	});
	$(".messages_error a").click(function(){$(".messages_error").fadeOut("slow");});
	$(".messages_error").click(function(){$(".messages_error").fadeOut("slow");});
	//$(".altertab tr:nth-child(even)").each(function(){$("tr td").css("background-color","#dcdcdc");});
	$(".altertab tr:nth-child(even)").each(function(){$(this).css("background-color","#dcdcdc");});
	$(".altertab tr").each(function(){var bc=$(this).css("background-color");$(this).hover(function(){$(this).css("background-color","#E3F6F7");},function(){$(this).css("background-color",bc)});});
	var w=$(window).width()-280;
	var s=w+"px";
	$(".maindiv").css("width",s);
	$("#tbYjfx").qtip({content:"如有多个研究方向，请以空格分开，例：移动互联网 无线通信",style: 'dark'});
	$("span[id$='labYjfx']").each(function(){var s=$(this).html();$(this).parent().qtip({content:s,style:'dark'});$(this).html(s.substr(0,6))});
	//alert($("span[id$='labYjfx']").length-2);
});
$(window).resize(function(){
	var w=$(window).width()-280;
	var s=w+"px";
	$(".maindiv").css("width",s);
});

function Login(username,password,key,url,FunExec)
{
    var md5value=MD5(key+password);
    var u=url+"?username"+encodeURI(username)+"&password"+encodeURI(md5value)+"&RandomNum="+Math.random();
    send_request("get",u,null,"text",FunExec);
}

function LoginCallBack()
{
	if(ICB())
	{
		var s=http_request.responseText;
		if(s=="failed")
		{
			var t1=document.getElementById("innerTD1");
			t1.innerHTML="报名库尚未上传，请先行上传再导入！";
			SetT2();
		}
		else
		{
			MyIntervalID=window.setInterval(GetBmkDRInfo,1000);
		}
	}
}

function CheckTextBoxValue(tb,reg,warning,validtype)
{
    var s=tb.value;
    switch(validtype)
    {
        case 1:  //必须为数字
           if(isNaN(s))
           {
                alert(warning);
                alert(warning);
                tb.focus();
                return;
            }
            break;
        case 2: //不能为空
            break;
    }
    if(!reg.test(s))
    {
        alert(warning);
        tb.focus();
    }
}

function LockScreen(tipDivID){
	//dhTipsLayer:author:dh20156;
	if(document.getElementById("dhtipsiframe")==null){
		var iframe = document.createElement("IFRAME");
		iframe.id = "dhtipsiframe";
		iframe.style.position = "absolute";
		iframe.style.left = 0;
		iframe.style.top = 0;
		iframe.style.width = (document.body.scrollWidth>document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth;
		iframe.style.height = (document.body.scrollHeight>document.body.offsetHeight)?document.body.scrollHeight+20:document.body.offsetHeight;
		iframe.style.zIndex=5000;
 
		var div = document.createElement("DIV");
		div.id = "dhtipsdiv";
		div.style.position = "absolute";
		div.style.left = 0;
		div.style.top = 0;
		div.style.width = (document.body.scrollWidth>document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth;
		div.style.height = (document.body.scrollHeight>document.body.offsetHeight)?document.body.scrollHeight+20:document.body.offsetHeight;
		div.oncontextmenu = function(){return false}
		div.onselectstart = function(){return false}
 
		var div2 = document.getElementById(tipDivID);
		div2.style.position = "absolute";
		div2.style.left = document.body.offsetWidth/2-150+document.body.scrollLeft;
		div2.style.top = document.body.offsetHeight/2-150+document.body.scrollTop;
		div2.style.display="block";
		div2.style.zIndex=10000;
		div2.oncontextmenu = function(){return false}
 
		document.body.appendChild(iframe);
		document.body.appendChild(div);
	}else{
		document.getElementById("dhtipsiframe").style.display = "block";
		document.getElementById("dhtipsdiv").style.display = "block";
		var div2 = document.getElementById(tipDivID);
		div2.style.position = "absolute";
		div2.style.left = document.body.offsetWidth/2-150+document.body.scrollLeft;
		div2.style.top = document.body.offsetHeight/2-150+document.body.scrollTop;
		div2.style.display="block";
		div2.oncontextmenu = function(){return false}
	}
	var l = document.body.scrollLeft;
	var t = document.body.scrollTop;
	document.body.style.overflow = "hidden";
	document.body.scrollLeft = l;
	document.body.scrollTop = t;
}

function UnLockScreen(tipDivID)
{
	document.body.style.overflow='auto';
	if(document.getElementById('dhtipsiframe')!=null)
	{
		document.getElementById('dhtipsiframe').style.display='none';
	}
	if(document.getElementById('dhtipsdiv')!=null)
	{
		document.getElementById('dhtipsdiv').style.display='none';
	}
	if(document.getElementById(tipDivID)!=null)
	{
		document.getElementById(tipDivID).style.display='none';
	}
}

function EnableFileUp(divID)
{
    var d=document.getElementById(divID);
    if(d.style.display=="none")
    {
        d.style.display="block";
    }
    else
    {
        d.style.display="none";
    }
}

function htmlEncode (str){
var div = document.createElement("div");
var text = document.createTextNode(str);
div.appendChild(text);
return div.innerHTML;
}
function htmlDecode (str){
var div = document.createElement("div");
div.innerHTML = str;
return div.innerHTML;
}